﻿@model WS.Model.OfficialAccount

@{
    ViewBag.Title = "Edit_PromptLanguage";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<br />
@*<div class="container">*@
<div>

    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#Welcome" aria-controls="Welcome" role="tab" data-toggle="tab">首次关注提示语</a></li>
        <li role="presentation"><a href="#ReWelcome" aria-controls="ReWelcome" role="tab" data-toggle="tab">重复扫码提示</a></li>
        <li role="presentation"><a href="#Sign" aria-controls="Sign" role="tab" data-toggle="tab">签到提示语</a></li>
        
    </ul>

    <!-- Tab panes -->
    <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="Welcome">
            <h3 class="text-danger">首次关注提示语</h3>
            <textarea id="welcometext">
                @Model.SubscribeWelcome
            </textarea>

            <button id="welcometext_save" class="btn btn-default">保存</button>
        </div>
        <div role="tabpanel" class="tab-pane" id="ReWelcome">
            <h3 class="text-danger">重复扫码提示</h3>
            <textarea id="rewelcometext">
                @Model.ReSubscribeWelcome
            </textarea>
            <button id="rewelcometext_save" class="btn btn-default">保存</button>

        </div>
        <div role="tabpanel" class="tab-pane" id="Sign">
            <h3 class="text-danger">签到提示语</h3>
            <textarea id="signtext">
                @Model.SignLanguage
            </textarea>
            <button id="signtext_save" class="btn btn-default">保存</button>


        </div>
    </div>

</div>
@*</div>*@

@section Scripts{
    <link href="~/Scripts/summernote/summernote.css" rel="stylesheet"/>
    <script src="~/Scripts/summernote/summernote.min.js"></script>
    <script src="~/Scripts/summernote/lang/summernote-zh-CN.js"></script>
    <script type="text/javascript">
        $(function() {


            $('#welcometext,#rewelcometext,#signtext').summernote({
                height: 300,
                minHeight: 300,
                maxHeight: null,
                focus: true,
                tabsize: 1,
                codemirror: {
                    //theme: 'monokai'
                    theme: 'darkly'
                },
                lang: "zh-CN",
                toolbar: [
                    ['insert', ['link']]
                ],
                //onImageUpload: SummerNoteUploadPointImages,
                onpaste: function(e) {
                    var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');

                    e.preventDefault();

                    setTimeout(function() {
                        document.execCommand('insertText', false, bufferText);
                    }, 10);
                }
            });


            $("#welcometext_save").click(function(e) {
                var cid="@Model.AccountID";
                var data = {
                    type: "welcome",
                    content: $('#welcometext').code(),
                    id:cid
                };

              
                $.ajax({
                    type: "POST",
                    url: '@Url.Action("Save_PromptLanguage", "OfficialAccount", new {Area = "Admin"})',
                    data: data,
                    dataType: "text",
                    success: function(response) {
                        alert(response);
                    }
                });
            });

            $("#rewelcometext_save").click(function (e) {
                var cid = "@Model.AccountID";
                var data = {
                    type: "rewelcome",
                    content: $('#rewelcometext').code(),
                    id: cid
                };

              
                $.ajax({
                    type: "POST",
                    url: '@Url.Action("Save_PromptLanguage", "OfficialAccount", new {Area = "Admin"})',
                    data: data,
                    dataType: "text",
                    success: function (response) {
                        alert(response);
                    }
                });
            });

            $("#signtext_save").click(function (e) {
                var cid = "@Model.AccountID";
                var data = {
                    type: "sign",
                    content: $('#signtext').code(),
                    id: cid
                };

                $.ajax({
                    type: "POST",
                    url: '@Url.Action("Save_PromptLanguage", "OfficialAccount", new {Area = "Admin"})',
                    data: data,
                    dataType: "text",
                    success: function (response) {
                        alert(response);
                    }
                });
            });
        });
</script>
}
